<?xml version="1.0" encoding="UTF-8"?>
<!--
    Welcome site of MusicPliz
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
	<title>MusicPliz</title>
	<h:outputStylesheet name="style.css" library="css" />
	<script language="javascript" src="../scripts/md5.js"></script>
	<script language="javascript">
<!--
	function doChallengeResponse() {
		document.forms['createForm'].elements['createForm:password'].value = MD5(document.forms['createForm'].elements['createForm:password'].value);
		return true;
	}
//-->
</script>

</h:head>
<h:body>
	<ui:include src="/WEB-INF/includes/header.xhtml" />
	<div id="container">
	<h:messages showDetail="false" showSummary="true" /> 
	<h:form id="createForm" class="classic">
		<h1>Créer un compte</h1>
		<p>
			<h:outputLabel for="typeCompte" value="type de compte" />
			<h:selectOneMenu id="typeCompte" required="true" value="#{CreateCompteBean.dto.type}">
				<f:selectItems value="#{CreateCompteBean.compteTypes}" />
				<f:ajax render="createForm" />
			</h:selectOneMenu>
		</p>
		<p>
			<h:outputLabel for="nom" value="nom" />
			<h:inputText id="nom" value="#{CreateCompteBean.dto.nom}" required="true" />
		</p>
		<p>
			<h:outputLabel for="prenom" value="prénom"
				rendered="#{CreateCompteBean.artiste || CreateCompteBean.particulier}" />
			<h:inputText id="prenom" value="#{CreateCompteBean.dto.prenom}" required="true"
				rendered="#{CreateCompteBean.artiste || CreateCompteBean.particulier}" />
		</p>
		<p>
			<h:outputLabel for="typeresto" value="type de restaurant"
				rendered="#{CreateCompteBean.professionnel}" />
			<h:inputText id="typeresto" value="#{CreateCompteBean.dto.typeResto}"
				rendered="#{CreateCompteBean.professionnel}" required="true" />
		</p>
		<p>
			<h:outputLabel for="desc" value="description"
				rendered="#{CreateCompteBean.professionnel}" />
			<h:inputText id="desc" value="#{CreateCompteBean.dto.description}"
				rendered="#{CreateCompteBean.professionnel}" required="true" />
		</p>
		<p>
			<h:outputLabel for="nomscene" value="nom de scène"
				rendered="#{CreateCompteBean.artiste}" />
			<h:inputText id="nomscene" value="#{CreateCompteBean.dto.nomScene}"
				rendered="#{CreateCompteBean.artiste}" required="true" />
		</p>
		<p>
			<h:outputLabel for="adresse" value="adresse" />
			<h:inputText id="adresse" value="#{CreateCompteBean.dto.adresse}"
				required="true" />
		</p>
		<p>
			<h:outputLabel for="codepostal"	value="code postal" />
			<h:inputText id="codepostal" value="#{CreateCompteBean.dto.codePostal}"
				required="true" />
			
		</p>
		<p>
			<h:outputLabel for="ville" value="ville" />
			<h:inputText id="ville" value="#{CreateCompteBean.dto.ville}"
				required="true" />
		</p>
		<p>
			<h:outputLabel for="numero"	value="téléphone" />
			<h:inputText id="numero" value="#{CreateCompteBean.dto.numero}" />
		</p>
		<p>
			<h:outputLabel for="instrument" value="instrument(s)"
				rendered="#{CreateCompteBean.artiste || CreateCompteBean.groupe || CreateCompteBean.particulier}" />
			<h:inputText id="instrument" value="#{CreateCompteBean.dto.instrument}"
				rendered="#{CreateCompteBean.artiste || CreateCompteBean.groupe || CreateCompteBean.particulier}"
				required="true" />
		</p>
		<p>
			<h:outputLabel for="typemusique" value="type de musique"
				rendered="#{CreateCompteBean.artiste || CreateCompteBean.groupe}" />
			<h:inputText id="typemusique" value="#{CreateCompteBean.dto.typeMusique}"
				rendered="#{CreateCompteBean.artiste || CreateCompteBean.groupe}"
				required="true" />
		</p>
		<p>
			<h:outputLabel for="material" value="material"
				rendered="#{CreateCompteBean.artiste || CreateCompteBean.groupe}" />
			<h:inputText id="material" value="#{CreateCompteBean.dto.material}"
				rendered="#{CreateCompteBean.artiste || CreateCompteBean.groupe}"
				required="true" />		
		</p>
		<p>
			<h:outputLabel for="mail" value="e-mail" />
			<h:inputText id="mail" value="#{CreateCompteBean.dto.mail}"
				required="true" />
		</p>
		<p>
			<h:outputLabel for="password" value="mot de passe" />
			<h:inputSecret id="password" value="#{CreateCompteBean.dto.password}"
				required="true" />		
		</p>
		<p>
			<h:inputHidden id="id" value="#{CreateCompteBean.dto.id}" />
			<h:commandButton onclick="doChallengeResponse();" value="créer"
				action="#{CreateCompteBean.createCompte}" />
		</p>
	</h:form>
	<div class="navigationLinks"> 
		<h:link outcome="#{NavigationBean.getLoginSite()}" value="retourner à la page de login" />
	</div>
	</div>
</h:body>
</html>
